<?php


namespace App\Observers;


use App\Exceptions\ApiException;
use App\Models\House;
use App\Models\Project;

class ProjectObserver
{
    public function deleting(Project $project)
    {
        $house=House::where('project',$project['id'])->first();
        if ($house)
            throw new ApiException("该类型下有房屋，不能删除");
    }

}
